#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QListWidget>
#include <QHash>
#include <QThread>
#include <scenecreator.h>
#include <tourspecs.h>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

    QHash<QString,sceneCreator*> sceneCreators;

protected:
    void changeEvent(QEvent *e);
    /*void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);*/

private:

    class creationThread:public QThread
    {
    public:
        enum mode{
            CREATE_SCENES = 0,
            CREATE_SLIDER_TOUR
        };
        creationThread(MainWindow* parent);
        void setMode(mode);
        mode getMode();
        void run();
    private:
        MainWindow* itsParent;
        mode itsMode;
    };

    bool readFile(const QString &fileName);
    Ui::MainWindow *ui;
    QHash<QString,QWidget*> tabs;
    creationThread *itsThread;

    void createParameterTab(QString name,sceneCreator* creator);
    void createParameterBox(QWidget* tab,sceneCreator* creator,tourSpecs* tSpecs);
    void openInBrowser(QString src);

public slots:
    void newItemAddedtoList(QListWidgetItem* item);
    void on_processStarted();
    void on_processEnded();

private slots:
    void on_makeSlides_clicked();
    void on_changeOutput_btn_clicked();
    void on_makeCube_btn_clicked();
    void on_listWidget_2_itemDoubleClicked(QListWidgetItem* item);
    void on_pushButton_clicked();
    void on_refresh_btn_clicked();
    void on_gotoURL_btn_clicked();
    void on_tabWidget_destroyed();
    void urlChanged();
    void on_tabClosed(int index);

Q_SIGNALS:
    void sign_processPercentage(int percentage);
};

#endif // MAINWINDOW_H
